
# 入口文件：

from flask import Flask
from flask_cors import CORS
from config import *
from database import db
from users import user


app = Flask(__name__)

# 进行转码：
app.config['JSON_AS_ASCII'] = False

# 配置跨域：
CORS(app,cors_allowed_origins = '*')


# 注册数据库：
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql://{}:{}@{}:{}/{}".format(
    mysql_user,mysql_password,mysql_host,mysql_port,mysql_db
)

# app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True

# 自动提交
app.config['SQLALCHEMY_COMMIT_ON_TEARDOWN'] = True

db.init_app(app)

# 创建蓝图：
app.register_blueprint(user)



# 开始：
if __name__ == '__main__':
    app.run(debug=True,host='0.0.0.0',port='5000')


















